package com.kotlin.lib


val repeatFun: String.(Int) -> String = { times -> this.repeat(times) }
val twoParameters: (String, Int) -> String = repeatFun // OK

fun runTransformation(f: (String, Int) -> String): String {
    return f("hello", 3)
}


class A {


    inner class B {
        fun Int.foo() {
            val a = this@A
            val b = this@B

            val c = this
            val c1 = this@foo

            val funList = lambada@ fun String.() {
                val d = this
            }

            val funList2 = { s: String ->
                val d1 = this
            }
        }
    }
}

val sum: Int.(Int) -> Int = { other -> plus(other) }

fun main() {
    val stringPlus: (String, String) -> String = String::plus
    val intPlus: Int.(Int) -> Int = Int::plus
    println(stringPlus("hello", " world") + intPlus(1, 2))
    println("hello ".plus("world") + 2.intPlus(1))

    1.sum(2)
    val result = runTransformation(repeatFun) // OK
    println(result)
    val b = A().B()
}


fun act(a: Int, b: Int): Int {
    return a + b
}